local skel = fk.CreateSkill{
  name = "kqf__tianzhao",
  tags = { Skill.Lord },
}

Fk:loadTranslationTable{
  ["kqf__tianzhao"] = "天照",
  [":kqf__tianzhao"] = "主公技，当一名群势力角色不因此横置后，你可以横置一名角色。",
  ["#kqf__tianzhaoask"] = "天照：你可以横置一名角色",

  ["$kqf__tianzhao1"] = "不要挣扎，好好接受命运的安排。",
  ["$kqf__tianzhao2"] = "你们，不过是我手中的木偶罢了。",

}

skel:addEffect(fk.ChainStateChanged, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and target.chained and target.kingdom == "qun" and not (player:getMark("kqf__tianzhao_notinthisskill") > 0)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room:getOtherPlayers(player, false), function (p)
      return p.chained == false
    end)
    local to = room:askToChoosePlayers(player, {
      targets = targets,
      min_num = 1,
      max_num = 1,
      prompt = "#kqf__tianzhaoask",
      skill_name = skel.name,
      cancelable = true,
      })
    if #to > 0 then
      event:setCostData(self, {tos = to})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self).tos[1]
    player:setMark("kqf__tianzhao_notinthisskill",1)
    to:setChainState(true)
    player:setMark("kqf__tianzhao_notinthisskill",0)
  end,
})

return skel